/* GUI CONVERTED from rejectb.p (converter v1.75) Sat Aug 12 23:05:56 2000 */
/* rejectb.p - REPETITIVE                                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                         */
/*K1Q4*/ /*V8:WebEnabled=No                                                   */
/* REVISION: 7.3               LAST MODIFIED: 10/31/94   BY: WUG *GN77*       */
/* REVISION: 8.6               LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan */
/* REVISION: 9.1               LAST MODIFIED: 08/12/00   BY: *N0KP* myb        */


/* REJECT TRANSACTION REGISTER REJECT QUANTITY SUBPROGRAM                     */
/* THIS MOVES A QTY FROM THE OUTPUT QUE OF FROM_OP TO OUTPUT QUE OF TO_OP     */


{mfdeclre.i} /*GUI moved to top.*/
def input param cumwo_lot as char.
def input param from_op as int.
def input param to_op as int.
def input param emp as char.
def input param shift as char.
def input param eff_date as date.
def input param qty_reject as dec.
def input param trans_type as char.

def var this_op as int.
def var ophist_recid as recid.
/*GUI moved mfdeclre/mfdtitle.*/

if qty_reject = 0 then leave.

this_op = from_op.

do while this_op <> to_op:
   /*MOVE QTY TO INPUT QUEUE OF THIS OP BY DOING A NEGATIVE PROCESS*/
   find wr_route where wr_lot = cumwo_lot and wr_op = this_op no-lock.
   find wc_mstr where wc_wkctr = wr_wkctr and wc_mch = wr_mch no-lock.

   {gprun.i ""reophist.p"" "(input trans_type,
   input cumwo_lot, input this_op, input emp,
   input wr_wkctr, input wr_mch, input wc_dept, input shift,
   input eff_date,
   output ophist_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   {gprun.i ""rebkfla.p"" "(input cumwo_lot, input this_op,
   input ophist_recid, input (- qty_reject))"}
/*GUI*/ if global-beam-me-up then undo, leave.


   if global_addr = ? then global_addr = string(ophist_recid).


   /*FIND OUT PREVIOUS OP NUMBER*/
   find last wr_route where wr_lot = cumwo_lot and wr_op < this_op no-lock.
   this_op = wr_op.
   find wc_mstr where wc_wkctr = wr_wkctr and wc_mch = wr_mch no-lock.


   /*NOW MOVE QTY TO OUTPUT QUE OF THIS PREVIOUS OP BY DOING A
   NEGATIVE MOVE*/
   {gprun.i ""reophist.p"" "(input trans_type,
   input cumwo_lot, input this_op, input emp,
   input wr_wkctr, input wr_mch, input wc_dept, input shift,
   input eff_date,
   output ophist_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   {gprun.i ""removea.p"" "(input cumwo_lot, input this_op, input eff_date,
   input ophist_recid, input (- qty_reject))"}
/*GUI*/ if global-beam-me-up then undo, leave.

end.
